<%--
  Created by IntelliJ IDEA.
  User: 星云
  Date: 2019/3/19
  Time: 17:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生列表</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="js/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/index.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="wrap">
    <!-- condition条件 -->
    <div id="condition">
        <form action="StudentServlet?flag=find" method="post">
            姓名:<input type="text" name="name" id="name"/>(模糊查询)
            &nbsp;&nbsp;&nbsp;&nbsp;
            年级:
            <select id="grade" name="grade">
                <c:forEach items="${grades}" var="i">
                    <option value="${i.gradeId}">${i.gradeName}</option>
                </c:forEach>
            </select>
            <input type="submit" value="查询"/>
        </form>
    </div>
    <!-- result展示结果 -->
    <div id="result">
        <table border="1" cellspacing="0" cellpadding="20">
            <tr>
                <th>编号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>年级</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${pageInfo.list}" var="li" varStatus="i">
                <tr>
                    <td>${li.id}</td>
                    <td>${li.name}</td>
                    <td>${li.sex}</td>
                    <td>${li.grade.gradeName}</td>
                    <td>
                        <a href="StudentServlet?flag=updPage&id=${li.id}">修改</a>
                        <a href="javascript:void(0);" class="del" sid="${li.id}">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        第${pageNum}页/共${pages}页
        <a href="StudentServlet?flag=paging&pageNum=1">首页</a>
        <c:if test="${pageNum-1>0}">
            <a href="StudentServlet?flag=paging&pageNum=${pageNum-1}">上一页</a>
        </c:if>
        <c:if test="${pageNum+1<=pages}">
            <a href="StudentServlet?flag=paging&pageNum=${pageNum+1}">下一页</a>
        </c:if>
        <a href="StudentServlet?flag=paging&pageNum=${pages}">尾页</a>
        <p></p>
        <a href="StudentServlet?flag=addPage">增加学生信息</a>
    </div>
</div>

</body>
</html>
